def isPalindrome(s: String): Boolean = {
  var i = 0
  var j = s.length - 1
  while (i < j) {
    if (s(i) != s(j)) {
      return false
    }
    i += 1
    j -= 1
  }
  true
}
val str1 = "level"
val str2 = "hello"
println(str1 + " is palindrome? " + isPalindrome(str1))
println(str2 + " is palindrome? " + isPalindrome(str2))
